<#include "common.ftl">
ALTER TABLE ${tableName}
<#-- 创建索引 -->
<#if indexes?? && indexes?size gt 0>
    <#list indexes as index>
        ADD <#t>
        <#if index.indexType == "FULLTEXT INDEX" || index.indexType == "SPATIAL INDEX">
            ${'\t'}${index.indexType} `${sanitize(index.indexName)}` (${index.fieldName})<#t>
        <#elseif index.indexType == "INVISIBLE INDEX">
            ${'\t'}INDEX `${sanitize(index.indexName)}` (${index.fieldName}) INVISIBLE<#t>
        <#else>
            ${'\t'}<#if index.indexType == "UNIQUE INDEX">UNIQUE </#if>INDEX `${sanitize(index.indexName)}` (${index.fieldName})<#t>
        </#if>
        <#if index.indexFunction?? && index.indexType != "PRIMARY KEY"> USING ${index.indexFunction}</#if><#t>
        <#if index.comment??> COMMENT '${sanitize(index.comment)}'</#if><#t>
        <#if index_has_next >,<#else >;<#t></#if>
    </#list>
</#if>

